﻿using Client.Model;
using Client.ViewModel.OrgViewModel;
using Client.ViewModel.PermissionViewModel;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading;

namespace Client.View.OrgView
{
    /// <summary>
    /// PermissionEdit.xaml 的交互逻辑
    /// </summary>
    public partial class OrgEdit : Window
    {

        public OrgEdit()
        {
            InitializeComponent();
            OrgEditViewModel = new OrgEditViewModel(this);
            DataContext = OrgEditViewModel;
        }

        public OrgEditViewModel OrgEditViewModel { get; private set; }

        public void BindParentContextAndEntity(OrgListViewModel dataContext = null, ViewOrg org = null)
        {
            OrgEditViewModel.Init(org, dataContext);
        }


        protected override void OnClosing(CancelEventArgs e)
        {
            e.Cancel = true;
            this.Hide();
        }


        //public void ParentOrgTextLostFocus()
        //{
        //    // 其他文本框获得焦点，父级组织文本框失去焦点

        //    this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
        //   (Action)(() => { OrgNameText.Focus(); }));

        //    //OrgNameText.Focus();
        //    //ParentOrgText.TabIndex = -1;
        //}


    }
}
